package com.demo.config;

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MpConfig {

    @Bean
    public MybatisPlusInterceptor mip(){
        MybatisPlusInterceptor mip = new MybatisPlusInterceptor();
        //分页功能拦截器
        mip.addInnerInterceptor(new PaginationInnerInterceptor());
        //添加乐观锁的拦截器
        mip.addInnerInterceptor(new OptimisticLockerInnerInterceptor());

        return mip;
    }
}
